import { Router } from 'express';
import { verifyToken } from '../../middleware/auth';
import {
  getHomeModules,
  getHomeModuleDetail,
  createHomeModule,
  updateHomeModule,
  deleteHomeModule,
  updateModuleStatus,
  updateModuleSort
} from './controller';

const router = Router();

// 所有路由都需要验证token
router.use(verifyToken);

// 获取首页模块列表
router.get('/', getHomeModules);

// 获取首页模块详情
router.get('/:id', getHomeModuleDetail);

// 创建首页模块
router.post('/', createHomeModule);

// 更新首页模块
router.put('/:id', updateHomeModule);

// 删除首页模块
router.delete('/:id', deleteHomeModule);

// 更新模块状态
router.put('/:id/status', updateModuleStatus);

// 更新模块排序
router.put('/:id/sort', updateModuleSort);

export default router; 